// -*-mode:c++; coding:utf-8-*-

#include <boost/pool/pool_alloc.hpp>

#ifndef _XBASE_CONFIG_HPP_
#define _XBASE_CONFIG_HPP_

// 只有原数据大于等于该值，才对其进行压缩
#define MIN_COMPRESS_BYTES (1024)


namespace xbase
{

	typedef std::allocator<char> default_char_allocator;

	template<typename T>
	struct basic_factory
	{
		typedef typename T::self_allocator_type allocator_type;

		static inline
		T *construct() {
			allocator_type m_allocator;
			T *p = m_allocator.allocate(1);
			//m_allocator.construct(p, T());
			new(p)T();
			return p;
		}

		static inline
		void destroy(T *p) {
			allocator_type m_allocator;
			m_allocator.destroy(p);
			m_allocator.deallocate(p);
		}
	};

} // namespace xbase

#endif	// _XBASE_CONFIG_HPP_


